﻿namespace JavaScript8000.Scaner
{
    /// <summary>
    /// Represent error occurred in Scaner
    /// </summary>
    public class ScanError
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="ScanError"/> class.
        /// </summary>
        /// <param name="row">
        /// The row where error ocured.
        /// </param>
        /// <param name="column">
        /// The column where error ocured.
        /// </param>
        /// <param name="index">
        /// The index of wrong char.
        /// </param>
        /// <param name="message">
        /// The message.
        /// </param>
        public ScanError(int row, int column, int index, string message)
        {
            this.Message = message;
            this.SymbolColumn = column;
            this.SymbolRow = row;
            this.SymbolIndex = index;
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets the error message.
        /// </summary>
        public string Message { get; private set; }

        /// <summary>
        /// Gets the symbol column.
        /// </summary>
        public int SymbolColumn { get; private set; }

        /// <summary>
        /// Gets the index of the symbol.
        /// </summary>
        public int SymbolIndex { get; private set; }

        /// <summary>
        /// Gets the symbol row.
        /// </summary>
        public int SymbolRow { get; private set; }

        #endregion

        #region Public Methods

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
           return string.Format("Row {0} Column {1} \"{2}\"", this.SymbolRow, this.SymbolColumn, this.Message);
        }

        #endregion
    }
}